//
//  LogicTableViewVC.m
//  SYPerfectDemo
//
//  Created by Lssyyy on 2018/4/27.
//  Copyright © 2018年 Lssyyy. All rights reserved.
//

#import "LogicTableViewVC.h"
#import "ClassifyCell.h"
#import "ThreadVC.h"
#import "SQLiteVC.h"
#import "RunLoopVC.h"
#import "singleObjectVC.h"
#import "RACVC.h"
#import "SYCodeMaker.h"
#import "ArithmeticVC.h"
#import "NetworkVC.h"
#import "CountDownVC.h"
#import "RunTimeVC.h"
@interface LogicTableViewVC ()
@property (nonatomic,strong) NSMutableArray *vcNameArray;
@end

@implementation LogicTableViewVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
}
- (void)addUI{
    [super addUI];
}

- (void)layoutUI{
    [super layoutUI];
}

- (void)config{
    self.title = @"逻辑";
    self.view.backgroundColor = RandomColor;
    [self.tableView registerClass:[ClassifyCell class] forCellReuseIdentifier:@"ClassifyCell"];
    
    [self.vcNameArray addObjectsFromArray:[NSArray arrayWithObjects:@"线程",@"数据库",@"RunLoop",@"单例",@"RAC", @"垃圾代码生成",@"常见算法",@"网络请求",@"计时器",@"runtime",nil]];
    [self.tableView reloadData];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _vcNameArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    ClassifyCell *cell = [ClassifyCell dequeueCellWithTableView:tableView indexPath:indexPath];
    [cell configContent:_vcNameArray[indexPath.row]];
    return cell;
}

- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return UITableViewAutomaticDimension;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.row) {
        case 0:{
            ThreadVC *vc = [[ThreadVC alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
            break;
        }
        case 1:{
            SQLiteVC *vc = [[SQLiteVC alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
            break;
        }
        case 2:{
            RunLoopVC *vc = [[RunLoopVC alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
            break;
        }
        case 3:{
            singleObjectVC *vc = [[singleObjectVC alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
             break;
        }
        case 4:{
            RACVC *vc = [[RACVC alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
            break;
        }
        case 5:{
            SYCodeMaker *vc = [[SYCodeMaker alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
            break;
        }
        case 6:{
            ArithmeticVC *vc = [[ArithmeticVC alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
            break;
        }
        case 7:{
            NetworkVC *vc = [[NetworkVC alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
            break;
        }
        case 8:{
            CountDownVC *vc = [[CountDownVC alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
            break;
        }
        case 9:{
            RunTimeVC *vc = [[RunTimeVC alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
            break;
        }
        default:
            break;
    }
}

- (NSMutableArray *)vcNameArray{
    if (!_vcNameArray) {
        _vcNameArray = [NSMutableArray array];
    }
    return _vcNameArray;
}

@end
